//
// Created by bigknife on 14-6-20.
// Copyright (c) 2014 shanglu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "ApiResponse.h"

//api 异步调用回调Block
typedef void (^API_CALLBACK)(NSInteger statusCode, ApiResponse *response, BOOL requestSucces);

@protocol AFIdonglerApiInvokerDelegate;
/*
*符合iDongler API规范的调用者
*/
@interface AFIdonglerApiInvoker : NSObject
- (void)request:(NSURLRequest *)request callback:(API_CALLBACK)callback;

+(id) apiInvokerWithBaseUrl:(NSString *)baseUrl;
@property (nonatomic, weak) id<AFIdonglerApiInvokerDelegate> delegate;
@end

@protocol AFIdonglerApiInvokerDelegate<NSObject>
@optional
-(void)handleError:(NSInteger)statusCode response:(ApiResponse *)apiResponse;
@end